﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:local="clr-namespace:CinchCodeGen"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna">

    <!-- ScrollBarPageButton -->
    <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="{DynamicResource transparentBackGround}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- VerticalScrolScrollBarThumbBar -->
    <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border 
          CornerRadius="4" 
          Background="{TemplateBinding Background}"
          BorderBrush="{TemplateBinding BorderBrush}"
          BorderThickness="1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- VerticalScrollBar -->
    <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid Background="{DynamicResource transparentBackGround}" >
            <Grid.RowDefinitions>
                <RowDefinition Height="0.00001*"/>
            </Grid.RowDefinitions>
            <Border
      Grid.RowSpan="1"
      CornerRadius="2" 
      Background="{DynamicResource transparentBackGround}" />
            <Track
      Name="PART_Track"
      Grid.Row="1"
      IsDirectionReversed="true">
                <Track.DecreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageUpCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Name="thumb"
          Style="{StaticResource ScrollBarThumb}" 
          Margin="3,0,3,0"  
          Background="#FFEF6803"
          BorderBrush="#FFEF6803" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageDownCommand" />
                </Track.IncreaseRepeatButton>

            </Track>
        </Grid>
    </ControlTemplate>

    <!-- HorizontalScrollBar -->
    <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid Background="{DynamicResource transparentBackGround}" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.00001*"/>
            </Grid.ColumnDefinitions>
            <Border
      Grid.ColumnSpan="1"
      CornerRadius="2" 
      Background="{DynamicResource transparentBackGround}" />
            <Track 
      Name="PART_Track"
      Grid.Column="1"
      IsDirectionReversed="False">
                <Track.DecreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageLeftCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Name="thumb"
          Style="{StaticResource ScrollBarThumb}" 
          Margin="0,3,0,3"  
          Background="#FFEF6803"
          BorderBrush="#FFEF6803" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageRightCommand" />
                </Track.IncreaseRepeatButton>
            </Track>
        </Grid>
    </ControlTemplate>

    <!-- ScrollBar -->
    <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto"/>
                <Setter Property="Height" Value="14" />
                <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Width" Value="14"/>
                <Setter Property="Height" Value="Auto" />
                <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- ScrollViewerStyle -->
    <Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="HorizontalScrollBarVisibility" Value="Visible" />
        <Setter Property="VerticalScrollBarVisibility" Value="Visible" />
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="ContextMenu" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <ScrollContentPresenter Grid.Column="0"/>

                        <ScrollBar Name="PART_VerticalScrollBar"
                            Grid.Column="1"
                            Value="{TemplateBinding VerticalOffset}"
                            Maximum="{TemplateBinding ScrollableHeight}"
                            ViewportSize="{TemplateBinding ViewportHeight}"
                            Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
                        <ScrollBar Name="PART_HorizontalScrollBar"
                            Orientation="Horizontal"
                            Grid.Row="1"
                            Grid.Column="0"
                            Value="{TemplateBinding HorizontalOffset}"
                            Maximum="{TemplateBinding ScrollableWidth}"
                            ViewportSize="{TemplateBinding ViewportWidth}"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Main Window Buttons -->
    <Style x:Key="mainWinButtons" TargetType="{x:Type Button}">
        <Setter Property="FontSize" Value="30"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Margin" Value="2,0,2,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="border" CornerRadius="5" 
                Background="White" 
                BorderBrush="Black" 
                BorderThickness="4" 
                Width="55" Height="55" Visibility="Visible">

                        <Label x:Name="lbl" Content="{TemplateBinding Content}" Foreground="Black" 
                   HorizontalAlignment="Center" VerticalAlignment="Center"/>

                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="border" Property="BorderBrush" Value="Black"/>
                            <Setter TargetName="border" Property="Background" Value="#FFEF6803"/>
                            <Setter TargetName="lbl" Property="Foreground" Value="Black"/>
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Image Button -->
    <Style x:Key="imageButtons" TargetType="{x:Type Button}">
        <Setter Property="Margin" Value="20,5,5,5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Image Width="Auto" Height="Auto" x:Name="img" Opacity="1.0"
                           Stretch="UniformToFill"
                           Source="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Tag}"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect Color="Black" 
                                      ShadowDepth="7" Direction="315" Opacity="0.7"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="img" Property="Opacity" Value="0.3"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Application ToolTip Styles -->
    <Style TargetType="ToolTip">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="HasDropShadow" Value="True"/>
        <Setter Property="Opacity" Value="0.8"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToolTip">
                    <Border Name="Border"
                          CornerRadius="2"
                          BorderBrush="Black"
                          Background="White"
                          BorderThickness="2"
                          Width="{TemplateBinding Width}"
                          Height="{TemplateBinding Height}">

                        <Label Foreground="Black" FontFamily="Tahoma"
                            FontWeight="Bold" FontSize="10"
                            Margin="2" Content="{TemplateBinding Content}"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Top" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasDropShadow" Value="true">
                            <Setter TargetName="Border" 
                                    Property="CornerRadius" 
                                    Value="4"/>
                            <Setter TargetName="Border" 
                                    Property="SnapsToDevicePixels" 
                                    Value="true"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Resize grip for window -->
    <Style x:Key="ResizeGripStyle1" TargetType="{x:Type ResizeGrip}">
        <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
        <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ResizeGrip}">
                    <Grid SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
                        <Path HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Data="M 9,0 L 11,0 L 11,11 L 0,11 L 0,9 L 3,9 L 3,6 L 6,6 L 6,3 L 9,3 z">
                            <Path.Fill>
                                <DrawingBrush TileMode="Tile" Viewbox="0,0,3,3" ViewboxUnits="Absolute" Viewport="0,0,3,3" ViewportUnits="Absolute">
                                    <DrawingBrush.Drawing>
                                        <DrawingGroup>
                                            <GeometryDrawing Brush="Black" Geometry="M 0,0 L 2,0 L 2,2 L 0,2 z "/>
                                        </DrawingGroup>
                                    </DrawingBrush.Drawing>
                                </DrawingBrush>
                            </Path.Fill>
                        </Path>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Custom Window : to allow repositioning of ResizeGrip-->
    <ControlTemplate x:Key="WindowTemplateKey" TargetType="{x:Type Window}">
        <Border Background="{TemplateBinding Background}" 
                BorderBrush="{TemplateBinding BorderBrush}" 
                BorderThickness="{TemplateBinding BorderThickness}">
            <Grid>
                <AdornerDecorator>
                    <ContentPresenter/>
                </AdornerDecorator>
                <ResizeGrip Visibility="Collapsed" 
                            HorizontalAlignment="Right" x:Name="WindowResizeGrip" 
                            Style="{DynamicResource ResizeGripStyle1}" 
                            VerticalAlignment="Bottom" IsTabStop="false"/>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="ResizeMode" Value="CanResizeWithGrip"/>
                    <Condition Property="WindowState" Value="Normal"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Visible"/>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>


    <!-- TextBox Styles-->
    <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinHeight" Value="20"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="TextElement.Foreground" Value="Black"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
        <Setter Property="MaxLength" Value="100"/>
        <Setter Property="UndoLimit" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBoxBase}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        
                        <Grid VerticalAlignment="Stretch" Grid.Column="0">
                            <Ellipse x:Name="el1" Fill="Black" VerticalAlignment="Top"
                                     HorizontalAlignment="Center" Width="5"
                                     Height="5" Margin="2"/>
                            <Ellipse x:Name="el2" Fill="Black" VerticalAlignment="Bottom"
                                     HorizontalAlignment="Center" Width="5"
                                     Height="5" Margin="2"/>
                        </Grid>
                    
                    
                        <Border 
                          Grid.Column="1"
                          Name="Border"
                          CornerRadius="3" 
                          Padding="1"
                          Background="White"
                          BorderBrush="Black"
                          BorderThickness="2" >
                            <Grid>
                                <Rectangle x:Name="dashes" Margin="1" StrokeThickness="1"
                                           HorizontalAlignment="Stretch" 
                                           VerticalAlignment="Stretch"
                                   Stroke="Transparent" StrokeDashArray="0.5 4"/>

                                <ScrollViewer Margin="0" x:Name="PART_ContentHost"
                                              HorizontalAlignment="Stretch" 
                                              VerticalAlignment="Center"/>
                            </Grid>
                        </Border>

                      
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="dashes" Property="Stroke" 
                                    Value="Black"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="LightGray"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="Black"/>
                            <Setter Property="Foreground" Value="Gray"/>
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" 
                                    Value="Red"/>
                            <Setter TargetName="el1" Property="Fill" 
                                    Value="Red"/>
                            <Setter TargetName="el2" Property="Fill" 
                                    Value="Red"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip"
                            Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                            Path=(Validation.Errors).CurrentItem.ErrorContent}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- Tab Brushes -->
    <SolidColorBrush x:Key="Disabled" Color="Gray"/>

    <!-- TabControl -->
    <Style x:Key="tab"  TargetType="{x:Type TabControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <StackPanel Orientation="Vertical"
                            Background="{TemplateBinding Background}"
                            Grid.Column="0"
                            Panel.ZIndex="1"
                            IsItemsHost="True"/>
                        <Border Margin="0,0,-1,-1"
                            SnapsToDevicePixels="True"
                            Grid.Column="1"
                            BorderBrush="Black"
                            BorderThickness="1"
                            Background="{TemplateBinding Background}"
                            CornerRadius="0">
                            <Grid x:Name="PART_ItemsHolder"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- TabItem -->
    <Style TargetType="{x:Type TabItem}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid>
                        <Border 
                            Name="Border"
                            Margin="0" 
                            BorderBrush="Transparent" 
                            BorderThickness="0" 
                            CornerRadius="0" >

                            <Grid x:Name="grid" HorizontalAlignment="Stretch">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="46"/>
                                    <RowDefinition Height="4"/>
                                </Grid.RowDefinitions>

                                <Grid Grid.Row="0" HorizontalAlignment="Stretch">

                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>

                                    <Polygon x:Name="Arrow" 
                                     Grid.Column="0"        
                                     HorizontalAlignment="Left" 
                                     VerticalAlignment="Center" Margin="4"
                                     Width="14" Height="14" 
                                     Fill="Transparent" 
                                     Visibility="Hidden">
                                        <Polygon.Points>
                                            <Point X="0" Y="0" />
                                            <Point X="0" Y="14" />
                                            <Point X="14" Y="7" />
                                        </Polygon.Points>
                                    </Polygon>

                                    <!-- Header placeholder-->
                                    <Label x:Name="lbl" Grid.Column="1"
                                        Foreground="#FFEF6803" FontSize="13" 
                                        FontStyle="Italic" FontWeight="Bold"
                                        Content="{Binding Path=DisplayName}" 
                                        VerticalAlignment="Center" />
                                </Grid>

                                <Rectangle x:Name="rect" Fill="Transparent" Grid.Row="1"
                                   HorizontalAlignment="Stretch" 
                                   VerticalAlignment="Stretch"/>

                            </Grid>

                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100" />
                            <Setter TargetName="Border" Property="Background" Value="Black" />
                            <Setter TargetName="Arrow" Property="Fill" Value="#FFEF6803" />
                            <Setter TargetName="Arrow" Property="Visibility" Value="Visible" />
                            <Setter TargetName="rect" Property="Fill" Value="#FFEF6803"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- tabHeader -->
    <DataTemplate x:Key="tabHeader">

        <Label x:Name="lbl" Margin="0" Content="{Binding}" 
           Foreground="White" FontSize="13" FontStyle="Italic"
           HorizontalAlignment="Stretch" FontWeight="Bold"
           HorizontalContentAlignment="Stretch"
           VerticalAlignment="Center" 
           FontFamily="Arial"/>

        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource 
               Mode=FindAncestor, AncestorType={x:Type TabItem}, 
               AncestorLevel=1}, Path=IsSelected}" Value="True">
                <Setter TargetName="lbl" 
                    Property="Foreground" 
                    Value="#FFEF6803" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <!-- CheckRadioFocusVisual -->
    <Style x:Key="CheckRadioFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle SnapsToDevicePixels="true" Margin="14,0,0,0" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type CheckBox}" TargetType="{x:Type CheckBox}">
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource CheckRadioFocusVisual}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <Grid VerticalAlignment="Stretch" Grid.Column="0">
                            <Ellipse x:Name="el1" Fill="Black" VerticalAlignment="Top"
                                     HorizontalAlignment="Center" Width="5"
                                     Height="5" Margin="2"/>
                            <Ellipse x:Name="el2" Fill="Black" VerticalAlignment="Bottom"
                                     HorizontalAlignment="Center" Width="5"
                                     Height="5" Margin="2"/>
                        </Grid>

                        <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Left">
                            <Border BorderBrush="Black" CornerRadius="3" Width="20"
                            Height="20" BorderThickness="2" Background="White">
                                <Image x:Name="checker" 
                                   Source="../Images/TickBlack.png" Width="20" Stretch="UniformToFill"
                                   VerticalAlignment="Center" HorizontalAlignment="Center" 
                                   Visibility="Hidden"/>
                            </Border>
                            <ContentPresenter HorizontalAlignment="Left"
                                TextElement.Foreground="Black"
                                Margin="2" VerticalAlignment="Center" 
                                RecognizesAccessKey="True"/>
                        </StackPanel>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="HasContent" Value="true">
                            <Setter Property="FocusVisualStyle" 
                                    Value="{StaticResource CheckRadioFocusVisual}"/>
                            <Setter Property="Padding" Value="4,0,0,0"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="checker" Property="Visibility" 
                                    Value="Visible"/>
                            <Setter Property="Padding" Value="4,0,0,0"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- RadioButton -->
    <Style x:Key="{x:Type RadioButton}" TargetType="{x:Type RadioButton}">
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource CheckRadioFocusVisual}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <Grid VerticalAlignment="Stretch" Grid.Column="0">
                            <Ellipse x:Name="el1" Fill="Black" VerticalAlignment="Top"
                                     HorizontalAlignment="Center" Width="5"
                                     Height="5" Margin="2"/>
                            <Ellipse x:Name="el2" Fill="Black" VerticalAlignment="Bottom"
                                     HorizontalAlignment="Center" Width="5"
                                     Height="5" Margin="2"/>
                        </Grid>

                        <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Left"  >
                            <Border BorderBrush="Black" CornerRadius="3" Width="20"
                            Height="20" BorderThickness="2" Background="White">
                                <Image x:Name="checker" 
                                   Source="../Images/TickBlack.png" Width="20" Stretch="UniformToFill"
                                   VerticalAlignment="Center" HorizontalAlignment="Center" 
                                   Visibility="Hidden"/>
                            </Border>
                            <ContentPresenter HorizontalAlignment="Left"
                                Margin="2" VerticalAlignment="Center" 
                                          RecognizesAccessKey="True"/>
                        </StackPanel>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="HasContent" Value="true">
                            <Setter Property="FocusVisualStyle" 
                                    Value="{StaticResource CheckRadioFocusVisual}"/>
                            <Setter Property="Padding" Value="4,0,0,0"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="checker" Property="Visibility" 
                                    Value="Visible"/>
                            <Setter Property="Padding" Value="4,0,0,0"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!-- CommonFocusVisualStyle -->
    <Style x:Key="CommonFocusVisualStyle">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="-2" StrokeThickness="1" 
                               Stroke="Black" StrokeDashArray="1 2"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!-- ComboBoxExTransparentButtonStyle -->
    <Style x:Key="ComboBoxExTransparentButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="Auto"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="ClickMode" Value="Press"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition SharedSizeGroup="ComboBoxButton" Width="Auto" 
                                              MinWidth="20"/>
                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="1" Content="q"  FontFamily="Wingdings 3" 
                               Foreground="Black" FontSize="8" 
                               VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,0,0,-9"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ComboBoxItem -->
    <Style x:Key="RegularComboBox" TargetType="ComboBoxItem">
        <Setter Property="HorizontalContentAlignment" 
                Value="{Binding Path=HorizontalContentAlignment, 
                    RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" 
                Value="{Binding Path=VerticalContentAlignment, 
                    RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBoxItem">
                    <Border 
                          Name="Border"
                          BorderThickness="0"
                          Padding="0"
                          CornerRadius="3"
                          Margin="0"
                          SnapsToDevicePixels="true">
                        <Label x:Name="cont" Margin="5,0,0,0" Padding="0"
                               Content="{TemplateBinding Content}"
                                Height="Auto" HorizontalAlignment="Left" 
                               VerticalContentAlignment="Center"
                                VerticalAlignment="Center" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="true">
                            <Setter TargetName="cont" Property="TextElement.Foreground" 
                                    Value="Black"/>
                            <Setter TargetName="cont" Property="TextElement.FontWeight" 
                                    Value="Bold"/>
                            <Setter TargetName="cont" Property="BitmapEffect" >
                                <Setter.Value>
                                    <OuterGlowBitmapEffect GlowColor="#FFEF6803" GlowSize="5" Opacity="0.6"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!-- ComboBox -->
    <Style x:Key="{x:Type ComboBox}" TargetType="{x:Type ComboBox}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource CommonFocusVisualStyle}"/>
        <Setter Property="Focusable" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="Height" Value="20"/>
        <Setter Property="ItemContainerStyle" Value="{StaticResource RegularComboBox}"/>
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Grid SnapsToDevicePixels="true">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Grid VerticalAlignment="Stretch" Grid.Column="0">
                                <Ellipse x:Name="el1" Fill="Black" VerticalAlignment="Top"
                                     HorizontalAlignment="Center" Width="5"
                                     Height="5" Margin="2"/>
                                <Ellipse x:Name="el2" Fill="Black" VerticalAlignment="Bottom"
                                     HorizontalAlignment="Center" Width="5"
                                     Height="5" Margin="2"/>
                            </Grid>

                            <Border x:Name="Border" Grid.Column="1" 
                                SnapsToDevicePixels="true" 
                                Height="{TemplateBinding Height}" 
                                Width="{TemplateBinding Width}"
                                VerticalAlignment="Center"
				                Background="White" 
				                CornerRadius="3"
				                BorderBrush="Black" 
				                BorderThickness="2">
                                <Grid Grid.IsSharedSizeScope="true" Background="White">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Label x:Name="item" Background="White" 
                                       SnapsToDevicePixels="True" 
                                       HorizontalAlignment="Left" 
                                       FontWeight="{TemplateBinding FontWeight}"
                                       FontSize="{TemplateBinding FontSize}"
                                       Margin="5,0,0,0" VerticalAlignment="Center" Padding="0"
                                       Grid.Column="0" Content="{TemplateBinding SelectionBoxItem}" 
                                       ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" 
                                       ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
                                    <ToggleButton Style="{StaticResource ComboBoxExTransparentButtonStyle}" 
                                        Grid.Column="0" Grid.ColumnSpan="2"
                                        IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, 
                                            RelativeSource={RelativeSource TemplatedParent}}"/>
                                </Grid>
                            </Border>

                           
                        </Grid>
                        <Popup x:Name="PART_Popup" Focusable="false" AllowsTransparency="true" 
                               IsOpen="{Binding Path=IsDropDownOpen, 
                               RelativeSource={RelativeSource TemplatedParent}}" 
                               Placement="Bottom" 
                               PopupAnimation="{DynamicResource 
                                {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" >
                            <Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" 
                                    MaxHeight="100" 
                                    MinWidth="{TemplateBinding ActualWidth}" 
                                    Color="Transparent">
                                <Border x:Name="DropDownBorder" CornerRadius="5"
                                        Background="White" 
                                        BorderBrush="Black" BorderThickness="2">
                                    <ScrollViewer Background="White">
                                        <ItemsPresenter 
                                            TextElement.FontSize="{TemplateBinding FontSize}"
                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                            KeyboardNavigation.DirectionalNavigation="Contained"/>
                                    </ScrollViewer>
                                </Border>
                            </Microsoft_Windows_Themes:SystemDropShadowChrome>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelectionBoxHighlighted" Value="true"/>
                                <Condition Property="IsDropDownOpen" Value="false"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Foreground" Value="Black"/>
                        </MultiTrigger>

                        <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
                            <Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
                            <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
                        </Trigger>

                        <Trigger Property="HasItems" Value="false">
                            <Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
                        </Trigger>

                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                        
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="LightGray"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="Black"/>
                            <Setter Property="Foreground" Value="Gray"/>
                        </Trigger>
                        
                        <Trigger Property="Validation.HasError" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" 
                                    Value="Red"/>
                            <Setter TargetName="el1" Property="Fill" 
                                    Value="Red"/>
                            <Setter TargetName="el2" Property="Fill" 
                                    Value="Red"/>
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip"
                            Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                            Path=(Validation.Errors).CurrentItem.ErrorContent}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

  



</ResourceDictionary>